﻿namespace HelperLibrary;

public static class XSSHelper
{
    /// <summary>
    /// XSS过滤
    /// </summary>
    /// <param name="html">html代码</param>
    /// <returns>过滤结果</returns>
    public static string XssFilter(string html)
    {
        string str = HtmlFilter(html);
        return str;
    }

    /// <summary>
    /// 过滤HTML标记
    /// </summary>
    /// <param name="Htmlstring"></param>
    /// <returns></returns>
    public static string HtmlFilter(string Htmlstring)
    {
        string result = Regex.Replace(Htmlstring, @"<[^>]*>", String.Empty); //System.Web.HttpUtility.HtmlEncode(Htmlstring);// 
        return result;
    }
}
